package imnu.ob;

import java.io.Serializable;

/**
 * @author: lys
 * @类名: Student
 * @Title:
 * @date: 2020/7/21
 **/
public class Student implements Serializable {
    //序列化版本号
    private static final long serialVersionUID = 1L;
    //定义属性
    private int stuAge;
    //使用transient关键字修饰，表示加密，不会被序列化处理
    private transient String stuName;
    private boolean stuSex;

    //无参构造方法
    public Student() {
    }
    //全参构造方法
    public Student(int stuAge, String stuName, boolean stuSex) {
        this.stuAge = stuAge;
        this.stuName = stuName;
        this.stuSex = stuSex;
    }

    //行为方法
    public void sayHi(){
        System.out.println("大家好。");
    }

    //getter和setter方法
    public int getStuAge() {
        return stuAge;
    }

    public void setStuAge(int stuAge) {
        this.stuAge = stuAge;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public boolean isStuSex() {
        return stuSex;
    }

    public void setStuSex(boolean stuSex) {
        this.stuSex = stuSex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuAge=" + stuAge +
                ", stuName='" + stuName + '\'' +
                ", stuSex=" + stuSex +
                '}';
    }
}
